
from gevent import monkey
monkey.patch_all()

import gevent
import urllib2

def task_function(url):
    print "GET: {url_str}".format(url_str = url)
    response = urllib2.urlopen(url)
    data = response.read()
    print "{length} bytes received from {url}".format(length = len(data),
                                                    url = url)

urllist = ['http://www.baidu.com', 'http://www.qq.com', 'http://www.qq.com', 'http://www.souhu.com','http://www.csdn.net' ]
joblist = []

for i in urllist:
    joblist.append(gevent.spawn(task_function, i))


gevent.joinall(joblist)

